package com.rppowell.pixie.swing.importer;

import javax.swing.JOptionPane;

import com.rppowell.pixie.swing.PixieJFrame;
import com.rppowell.pixie.swing.PixieListener;

public class SpriteSetImporter {

    private PixieJFrame jframe;
    private PixieListener listener;

    public SpriteSetImporter(PixieJFrame jframe, PixieListener listener) {
        this.jframe = jframe;
        this.listener = listener;
    }
    public void doImporterDialog() {
        SpriteSetImporterDialogPanel spritesheetimporterdialogpanel = new SpriteSetImporterDialogPanel();

        int n = JOptionPane.showConfirmDialog(
                jframe,
                spritesheetimporterdialogpanel,
                "Import Image to Sprites",
                JOptionPane.OK_CANCEL_OPTION);
        if (n == JOptionPane.OK_OPTION) {
            SpriteSetImporterProperties properties = spritesheetimporterdialogpanel.generateImporterProperties();
            listener.doSpriteSetImport(properties);
        }
    }
}
